/**
 * Parser string to Address object
 * String format: STREET,CITY,STATE,ZIP,COUNTRY
 */
package data.converter.parser;

import data.converter.model.Address;

public class ParserToAddress {

	/**
	 * @param strValue Follow the "String format" strictly
	 * @return address
	 */
	public Address convertToAddress(String strValue) {
		Address address = new Address();
		String[] items = strValue.split(",");
		address.setStreet(items[0] != null ? items[0] : "");
		address.setCity(items[1] != null ? items[1] : "");
		address.setState(items[2] != null ? items[2] : "");
		address.setZip(items[3] != null ? items[3] : "");
		address.setCountry(items[4] != null ? items[4] : "");
		return address;
	}
}
